<?php
namespace app\common\model;

use think\Model;

class Order extends BaseModel   //model层 数据添加到数据库
{

	 public function add($data){
		 $data['status'] = 1;

         $this->save($data);
		return $this->id;
		 
		 }


public function updateOrderByOutTradeNo($outTradeNo, $weixinData){
	    if(!empty($weixinData['transaction_id'])){
			  $data['transaction_id'] = $weixinData['transaction_id'];
			}
	   if(!empty($weixinData['total_fee'])){
			  $data['pay_amount'] = $weixinData['total_fee']/100;
			 $data['pay_status'] = 1; 
			}
	    if(!empty($weixinData['time_end'])){
			  $data['pay_time'] = $weixinData['time_end'];
			}
		 

         
		return $this->allowField()->save($data, ['out_trade_no'=>$outTradeNo]);
		 
		 }










}